<template>
  <div>
    <BasicModal
      v-bind="$attrs"
      :title="t('routes.demo.documentManager.instanceDetailSet.workflowInstanceInfo')"
      @register="register"
      @ok="handleSubmit"
      @cancel="handleCancel"
      :destroyOnClose="true"
      :minHeight="600"
      :width="1200"
    >
      <flowDesign :currentRecord="currentRecord" />
    </BasicModal>
  </div>
</template>

<script lang="ts" setup>
  import { ref } from 'vue';
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import { useI18n } from '/@/hooks/web/useI18n';

  import flowDesign from '/@/views/demo/documentManager/components/flowDesign.vue';

  const { t } = useI18n();
  const currentRecord = ref<any>({});

  // 提交
  async function handleSubmit() {
    handleCancel();
  }

  const handleCancel = () => {
    closeModal();
  };

  // 初始化弹窗
  const [register, { setModalProps, closeModal }] = useModalInner((data) => {
    setModalProps({ confirmLoading: false });
    currentRecord.value = data.currentRecord;
  });
</script>
